import com.java.demo.controller.UserController;
import com.java.demo.controller.UserController1;
import com.java.demo.controller.UserController2;
import com.java.demo.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-config.xml");
//        Test1 test1 = applicationContext.getBean("test1",Test1.class);
//        test1.hello();
//
//        Test1 a = applicationContext.getBean("test1",Test1.class);
//        Test2 a1 = applicationContext.getBean("test2",Test2.class);
//        a1.hello();

        //使用bean注解，写方法名
//        User user = applicationContext.getBean("getUserByName",User.class);
//        System.out.println(user.getUsername());

        UserController userController = applicationContext.getBean("userController", UserController.class);
        userController.hello();
        userController.hi();

    }
}
